GBML manual / Effects

effect_stop

Stops the running particle system `sys` that this instance started (or that the room is running with effect_start_room), and gives its slot back at once. Particles already in the air finish their own lives rather than vanishing mid-flight.

Syntax

effect_stop(sys)

Arguments

NameType
syseffect

Returns

Nothing.

Description

Stops the effect sys that is running from effect_start in this instance (or from effect_start_room in the room), and gives its slot back at once. A one-shot effect_burst needs no equivalent call - it stops itself the moment its own particles finish their lives.

You do not need it just to clean up

A running system ends by itself when the instance that started it is destroyed, or when the room changes. So you never have to call effect_stop from a Destroy event. Use it when the instance carries on but the effect should not: a torch that gets put out, a wreck that finally stops smoking.

Particles already in the air finish naturally

Stopping a system only stops it from making new particles - whatever it had already spawned keeps living out its own remaining life exactly as authored, fading and moving until it would have anyway. A torch put out mid-flicker does not make its embers vanish; they simply stop being replaced.

Safe to call whenever you like

If sys is not running, effect_stop does nothing - never a crash, never an error - so you do not need to check first. It only looks at this instance's own system and at the room's; it never stops a system that a different instance started.

Example

effect_start(fx_doc_spark, x, y);
effect_stop(fx_doc_spark);

Starts an effect and stops it again straight away, to show the call in isolation - a real project stops one later, when something happens (the torch is put out), not on the line after it starts.

On the GBA

You do not need this just to clean up: a system ends by itself when the instance that started it is destroyed or the room changes. Use it to turn an effect off while the instance carries on - a torch that gets put out. Stopping an effect that is not running does nothing, so it is safe to call whenever you like. It looks at this instance’s own system and at the room’s, never at another instance’s.

See also: Particles and lightingeffect_starteffect_start_room